package com.logic.landseaserver.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.logic.common.exception.BusinessException;
import com.logic.common.util.QueryUtil;
import com.logic.landseaserver.domain.ConfigurationQiyuesuo;
import com.logic.landseaserver.persistence.read.ConfigurationQiyuesuoReadMapper;
import com.logic.landseaserver.persistence.write.ConfigurationQiyuesuoWriteMapper;
import com.logic.landseaserver.service.IConfigurationQiyuesuoService;

@Service
public class ConfigurationQiyuesuoServiceImpl implements IConfigurationQiyuesuoService {

    @Autowired
    private ConfigurationQiyuesuoReadMapper configurationQiyuesuoReadMapper;
    @Autowired
    private ConfigurationQiyuesuoWriteMapper configurationQiyuesuoWriteMapper;

	@Override
	public void delete(String arg0) throws BusinessException {
		// TODO Auto-generated method stub

	}

	@Override
	public Object get(Integer arg0) throws BusinessException {
		ConfigurationQiyuesuo configurationQiyuesuo = configurationQiyuesuoReadMapper.selectByPrimaryKey(arg0);
		return configurationQiyuesuo;
	}

	@Override
	public int insert(Object arg0) throws BusinessException {
		ConfigurationQiyuesuo configurationQiyuesuo = (ConfigurationQiyuesuo) arg0;
		configurationQiyuesuoWriteMapper.insertSelective(configurationQiyuesuo);
		return 0;
	}

	@Override
	public List<?> query(QueryUtil arg0) {
		List<?> configurationList = configurationQiyuesuoReadMapper.getConfigurationList(arg0);
		return configurationList;
	}

	@Override
	public void update(Object arg0) throws BusinessException {
		ConfigurationQiyuesuo configurationQiyuesuo = (ConfigurationQiyuesuo) arg0;
		configurationQiyuesuoWriteMapper.updateByPrimaryKeySelective(configurationQiyuesuo);
	}

	@Override
	public Boolean validate(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean validateForDelete(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean validateForInsert(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean validateForUpdate(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int save(ConfigurationQiyuesuo record) throws BusinessException {
		Integer projectId = record.getProjectId();
		Object object = this.get(projectId);
		if (object == null) {
			this.insert(record);
		} else {
			this.update(record);
		}
		return 0;
	}

}
